<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */


App::uses('AppModel', 'Model');

class Alumno extends AppModel {
     
	 public $name = 'Alumno';
	public $belongsTo = array(
		'Apoderado' => array(
			'className' => 'Apoderado',
			'foreignKey' => 'apoderado_id'
			
		));
        
        	
	// JW - Behavior initiated from plugin. 
	public $actsAs = array(
		'Search.Searchable');

	// JW - Search fields data description for processing.
	public $filterArgs = array(
		array('name' => 'nombre', 'type' => 'query', 'method' => 'filterNombre'),
		
	);
	
		
		public function filterNombre($data, $field = null) {
		if (empty($data['nombre'])) {
			return array();
		}
		$nombre = '%' . $data['nombre'] . '%';
		return array(
			'OR'  => array(
				$this->alias . '.nombre LIKE' => $nombre,
				
			));
	}
	
	
	}
	